#! /usr/bin/python3

import qrcode
import sys

if len(sys.argv) <= 1 :
    print("please input: mkqrcode url")
    exit()

url = sys.argv[1]
qrcode_name = sys.argv[2]

qr = qrcode.QRCode(version=1,
    error_correction=qrcode.constants.ERROR_CORRECT_L,
    box_size=10,
    border=4,
)

qr.add_data(url)
qr.make(fit=True)

img = qr.make_image(fill_color="black", back_color="white")

qrcode_name=qrcode_name+"_qrcode.png"
img.save(qrcode_name)
